OCLOperators isEmpty
Created by Alexandra on 2017-08-13 · Last edited by Peter.byaruhanga on 2025-12-09.
isEmpty () : Boolean
Returns true if self is empty - otherwise, returns false.
| Expression | Result |
|---|---|
| Sequence{2, 1}->isEmpty() | false |
| Sequence{nil}->isEmpty | true |
| <class>.EmptyList->isEmpty | true |
Example
Given Class Car
Car.allinstances->subsequence(0,49)->isEmptyThe above will return true if the collection is empty
Warning!
Never use ->isEmpty on a value type. The value will be converted to a list (with the value as its only item) and that will always evaluate as False.
See also: OCLOperators notEmpty
